<?php
session_start();
include "../../biblioteca/funcao.php";

$sql = "SELECT * FROM logisticaabastecimento as logistica
INNER JOIN pais ON pais.pai_id=logistica.pai_id
INNER JOIN aeronave ON aeronave.aer_id=logistica.aer_id
LEFT JOIN cliente ON cliente.cli_id=logistica.cli_id
LEFT JOIN posto ON posto.pos_id=cliente.pos_id
WHERE logistica.sta_id='1' AND logistica.log_id='{$_GET['log_id']}' ORDER BY logistica.log_data DESC"; 
$res = sql($sql);
$linha = mysql_fetch_array($res);
?>
<html>
    
    <head>
        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="../../plugin/estilo.css">
        <link rel="stylesheet" href="../../plugin/bootstrap/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="../../plugin/bootstrap/css/bootstrap.css"> 
        <script type="text/javascript" src="../../plugin/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../../plugin/bootstrap/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="../../plugin/funcao.js" /></script>

        <title><?=$_SESSION['pro_nome'];?></title>
        <link href="../../midia/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
            <!--[if lt IE 9]>
            <script src="plugin/html5.js"></script>
        <![endif]-->
        
    </head>
    
    <body onLoad="window.print();">
        
        <div style="padding:20px;">
            
            <h4>Logística - Apoio</h4>
        
            <label>Solicitante: <?php echo "{$linha['cli_code']} - {$linha['pos_nome']} {$linha['cli_nome']}"; ?></label>
            <label>País: <?php echo $linha['pai_nome'];?></label>
            <label>Aeronave: <?php echo $linha['aer_nome'];?></label>
            <label>Quantidade: <?php echo $linha['log_qtd'];?></label>
            <label>Service Local Time: <?php echo todatabr($linha['log_dataabast']).$linha['log_hora'];?></label>
            <label>Appron Place: <?php echo $linha['log_local'];?></label>
            <label>Time of Dep: <?php echo $linha['time_dept'];?></label>
            
            <hr>
            
            <h4>Ações</h4>
            
            <?php
            $sql_acao = "SELECT * FROM logisticaacao 
            INNER JOIN logistica ON logistica.log_id=logisticaacao.log_id
            LEFT JOIN cliente ON cliente.cli_id=logisticaacao.cli_id
            LEFT JOIN posto ON posto.pos_id=cliente.pos_id
            LEFT JOIN logisticastatus ON logisticastatus.log_sta_id=logisticaacao.log_sta_id
            WHERE logisticaacao.log_id='{$linha['log_id']}' ORDER BY logisticaacao.aca_data DESC, logisticaacao.aca_hora DESC";
            $res_acao = sql($sql_acao);
            $x=0;
            while($linha_acao = mysql_fetch_array($res_acao)){
                
                echo "<p><i class='icon-plus'></i> <span style='color:#{$linha_acao['log_sta_cor']}'>{$linha_acao['log_sta_nome']}</span> - ".todatabr($linha_acao['aca_data'])."  {$linha_acao['aca_hora']}h</p>";
                echo "<p>{$linha_acao['aca_msg']}</p>"; 
                echo "<p>Solucionador: {$linha_acao['cli_code']} {$linha_acao['pos_nome']}{$linha_acao['cli_nome']}</p>"; 
                echo "<br>";
                
            }
            ?>
                
        </div>
        
    </body>
    
</html>